package server;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;

@Deprecated
public class MyClassLoader extends ClassLoader {

    protected Class<?> findClass(String classPath, String name) throws ClassNotFoundException {
        String resultPath = "file://" + classPath + name + ".class";
        byte[] classbytes = null;
        try {
            classbytes = Files.readAllBytes(Paths.get(new URI(resultPath)));
        } catch (IOException e) {
            e.printStackTrace();
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
        return defineClass(name, classbytes, 0, classbytes.length);
    }
}
